/**
 * 给全局 ctx 注入通用ObjectId 方法
 */

import { ObjectID } from "mongodb";
import { ContextProp } from "../appTypes";


export const injectObject = async(ctx:ContextProp,next:any)=>{
  ctx.getId = (id: string) => {
    return new ObjectID(id);
  };
  await next();
}